layui.use(['layer', 'form', 'admin', 'ax','upload','laydate'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var upload=layui.upload;
    var laydate=layui.laydate;

    // 图片压缩
    function canvasDataURL(file, callback) { //压缩转化为base64
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (e) {
            const img = new Image();
            const quality = 0.2 ;// 图像质量比例
            const canvas = document.createElement('canvas');
            const drawer = canvas.getContext('2d');
            img.src = this.result;
            img.onload = function () {
                canvas.width = img.width;
                canvas.height = img.height;
                drawer.drawImage(img, 0, 0, canvas.width, canvas.height);
                convertBase64UrlToBlob(canvas.toDataURL(file.type, quality), callback);
            }
        }
    }
    function convertBase64UrlToBlob(urlData, callback) { //将base64转化为文件格式
        const arr = urlData.split(',');
        const mime = arr[0].match(/:(.*?);/)[1];
        const bstr = atob(arr[1]);
        let n = bstr.length;
        const u8arr = new Uint8Array(n);
        while (n--) {
            u8arr[n] = bstr.charCodeAt(n)
        }
        callback(new Blob([u8arr], {
            type: mime
        }));
    }

    //渲染时间选择框
    laydate.render({
        elem: '#xdrq',
        trigger: 'click',
    });
    $("#auto").hide();
    $("#autoOne").hide();
    $("#autoTwo").hide();
    $("#fwkmztOne").hide();
    $("#fwkmztTwo").hide();
    $("#fwkmztThree").hide();
    $("#fwgcztOne").hide();
    $("#fwgcztTwo").hide();
    $("#fwgcztThree").hide();

    form.on("radio(ticketAutoState)", function (data) {
        if (this.value == '否') {
            $("#auto").show();
        }
        else if (this.value == '是') {
            $("#auto").hide();
        }
    });

    form.on("radio(stateOne)", function (data) {
        if (this.value == '否') {
            $("#autoOne").show();
        }
        else if (this.value == '是') {
            $("#autoOne").hide();
        }
    });
    form.on("radio(stateTwo)", function (data) {
        if (this.value == '否') {
            $("#autoTwo").show();
        }
        else if (this.value == '是') {
            $("#autoTwo").hide();
        }
    });
    form.on("radio(fwkmzt)", function (data) {
        if (this.value == '否') {
            $("#fwkmztOne").show();
        }
        else if (this.value == '是') {
            $("#fwkmztOne").hide();
        }
    });
    form.on("radio(otherFwkmzt)", function (data) {
        if (this.value == '否') {
            $("#fwkmztTwo").show();
        }
        else if (this.value == '是') {
            $("#fwkmztTwo").hide();
        }
    });
    form.on("radio(othersFwkmzt)", function (data) {
        if (this.value == '否') {
            $("#fwkmztThree").show();
        }
        else if (this.value == '是') {
            $("#fwkmztThree").hide();
        }
    });
    form.on("radio(fwgczt)", function (data) {
        if (this.value == '否') {
            $("#fwgcztOne").show();
        }
        else if (this.value == '是') {
            $("#fwgcztOne").hide();
        }
    });
    form.on("radio(otherFwgczt)", function (data) {
        if (this.value == '否') {
            $("#fwgcztTwo").show();
        }
        else if (this.value == '是') {
            $("#fwgcztTwo").hide();
        }
    });
    form.on("radio(othersFwgczt)", function (data) {
        if (this.value == '否') {
            $("#fwgcztThree").show();
        }
        else if (this.value == '是') {
            $("#fwgcztThree").hide();
        }
    });

 // var dm=$("#dm").val();
 //  if(dm==""){
 //      Feng.error("请选择店名!");
 //      return;
 //  }
    //外围状态多图片上传
    var arr=[];
    upload.render({
        elem: '#many_wwztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};//关键代码
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        // 图片压缩
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-wwztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-wwztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr.push(res.data.src);
            $("#wwztimg").val(arr);
        }
    });
    //前厅地面多图片上传
    var arr1=[];
    upload.render({
        elem: '#many_qtdmztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-qtdmztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-qtdmztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr1.push(res.data.src);
            $("#qtdmztimg").val(arr1);
        }
    });
    //灯光状态多图片上传
    var arr2=[];
    upload.render({
        elem: '#many_dgztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-dgztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-dgztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr2.push(res.data.src);
            $("#dgztimg").val(arr2);
        }
    });
    //装饰物状态多图片上传
    var arr3=[];
    upload.render({
        elem: '#many_zswztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-zswztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-zswztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr3.push(res.data.src);
            $("#zswztimg").val(arr3);
        }
    });
    //吧台物品状态多图片上传
    var arr4=[];
    upload.render({
        elem: '#many_btwpztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-btwpztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-btwpztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr4.push(res.data.src);
            $("#btwpztimg").val(arr4);
        }
    });

    //前厅状态多图片上传
    var arr5=[];
    upload.render({
        elem: '#many_qtztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-qtztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-qtztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr5.push(res.data.src);
            $("#qtztimg").val(arr5);
        }
    });
    //自助台状态多图片上传
    var arr6=[];
    upload.render({
        elem: '#many_zztztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-zztztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-zztztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr6.push(res.data.src);
            $("#zztztimg").val(arr6);
        }
    });

    //餐具状态多图片上传
    var arr7=[];
    upload.render({
        elem: '#many_cjztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-cjztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-cjztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr7.push(res.data.src);
            $("#cjztimg").val(arr7);
        }
    });
    //洗手间状态多图片上传
    var arr8=[];
    upload.render({
        elem: '#many_xsjztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-xsjztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-xsjztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr8.push(res.data.src);
            $("#xsjztimg").val(arr8);
        }
    });
    //后厨通风状态多图片上传
    var arr9=[];
    upload.render({
        elem: '#many_hctsztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-hctsztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-hctsztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr9.push(res.data.src);
            $("#hctsztimg").val(arr9);
        }
    });
    //后厨墙面状态多图片上传
    var arr10=[];
    upload.render({
        elem: '#many_hcqmztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-hcqmztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-hcqmztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr10.push(res.data.src);
            $("#hcqmztimg").val(arr10);
        }
    });

    //后厨地面状态多图片上传
    var arr11=[];
    upload.render({
        elem: '#many_hcdmztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-hcdmzt").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-hcdmzt',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr11.push(res.data.src);
            $("#hcdmztimg").val(arr11);
        }
    });
    //后厨地面状态多图片上传
    var arr12=[];
    upload.render({
        elem: '#many_hcsbztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-hcsbzt").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-hcsbzt',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr12.push(res.data.src);
            $("#hcsbztimg").val(arr12);
        }
    });
    //洗碗间状态多图片上传
    var arr13=[];
    upload.render({
        elem: '#many_xwjztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-xwjztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-xwjztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr13.push(res.data.src);
            $("#xwjztimg").val(arr13);
        }
    });

    //烤炉状态多图片上传
    var arr14=[];
    upload.render({
        elem: '#many_klztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-klztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-klztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr14.push(res.data.src);
            $("#klztimg").val(arr14);
        }
    });

    //冰箱状态多图片上传
    var arr15=[];
    upload.render({
        elem: '#many_bxztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-bxztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-bxztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr15.push(res.data.src);
            $("#bxztimg").val(arr15);
        }
    });

    //豆浆机状态多图片上传
    var arr16=[];
    upload.render({
        elem: '#many_djjztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-djjztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-djjztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr16.push(res.data.src);
            $("#djjztimg").val(arr16);
        }
    });

    //油烟罩状态多图片上传
    var arr17=[];
    upload.render({
        elem: '#many_yyzztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-yyzztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-yyzztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr17.push(res.data.src);
            $("#yyzztimg").val(arr17);
        }
    });

    //下水道状态多图片上传
    var arr18=[];
    upload.render({
        elem: '#many_xsdztimg_upload_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-xsdztimg").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-xsdztimg',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arr18.push(res.data.src);
            $("#xsdztimg").val(arr18);
        }
    });

    //仪容仪表多图片上传
    var arrYryb=[];
    upload.render({
        elem: '#many_img_upload_yryb_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-yryb").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-yryb',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrYryb.push(res.data.src);
            $("#yrybImg").val(arrYryb);
        }
    });

    //大众点评多图片上传
    var arrDzdp=[];
    upload.render({
        elem: '#many_img_upload_dzdp_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-dzdp").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-dzdp',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrDzdp.push(res.data.src);
            $("#dzdpImg").val(arrDzdp);
        }
    });

    //烤鱼多图片上传
    var arrKy=[];
    upload.render({
        elem: '#many_img_upload_ky_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-ky").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-ky',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrKy.push(res.data.src);
            $("#kyImg").val(arrKy);
        }
    });

    //烤鱼多图片上传
    var arrOtherKy=[];
    upload.render({
        elem: '#many_img_upload_otherKy_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-otherKy").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-otherKy',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrOtherKy.push(res.data.src);
            $("#otherKyImg").val(arrOtherKy);
        }
    });

    //米饭多图片上传
    var arrRice=[];
    upload.render({
        elem: '#many_img_upload_rice_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-rice").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-rice',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrRice.push(res.data.src);
            $("#riceImg").val(arrRice);
        }
    });

    //产品多图片上传
    var arrPro=[];
    upload.render({
        elem: '#many_img_upload_pro_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-pro").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-pro',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrPro.push(res.data.src);
            $("#proImg").val(arrPro);
        }
    });

    //产品多图片上传
    var arrOtherPro=[];
    upload.render({
        elem: '#many_img_upload_otherPro_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-otherPro").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-otherPro',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrOtherPro.push(res.data.src);
            $("#otherProImg").val(arrOtherPro);
        }
    });

    //产品多图片上传
    var arrOthersPro=[];
    upload.render({
        elem: '#many_img_upload_othersPro_btn'
        ,url: '/btyBxda/upload' //改成您自己的上传接口
        ,multiple: true
        ,auto:false
        ,before: function(obj){
            this.data={'dm':$('#dm').val()};
            //预读本地文件示例，不支持ie8
            // obj.preview(function(index, file, result){
            //     $('#uploader-list').append('<img style="width: 80px;height: 80px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
            // });
        }
        ,choose: function (obj) { //选择文件后的回调
            var files = obj.pushFile();
            var filesArry = [];
            for (var key in files) { //将上传的文件转为数组形式
                filesArry.push(files[key])
            }
            var index = filesArry.length - 1;
            var file = filesArry[index]; //获取最后选择的图片,即处理多选情况

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
                .replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
                return obj.upload(index, file)
            }
            canvasDataURL(file, function (blob) {
                var aafile = new File([blob], file.name, {
                    type: file.type
                });
                var isLt1M;
                if (file.size < aafile.size) {
                    isLt1M = file.size
                } else {
                    isLt1M = aafile.size
                }
                if (isLt1M / 1024 / 1024 > 2) {
                    return layer.alert('上传图片过大！')
                } else {
                    if (file.size < aafile.size) {
                        return obj.upload(index, file)
                    }
                    obj.upload(index, aafile)
                }
            })
        }
        ,done: function(res){
            //获取到图片拼接展示
            $("#uploader-list-othersPro").append(
                '<div id="pic" class="file-iteme">' +
                '<div class="handle"><span class="layui-icon"></span></div>' +
                "<div class='gs-upload-file-container'>"+
                "<div class='gs-upload-ele'>"+
                "<div class='progress-bar progress-bar-success progress-bar-striped gs-upload-progress-bar' style='width: 188px; display: none;'></div>" +
                "<div class='gs-upload-ele-img-div'>"+
                "<img class='gs-upload-ele-img' src='"+res.data.src+"' style='cursor: pointer;width: 80px;height: 80px;'>"+
                "</div>	"+
                "<div class='gs-upload-ele-content'>"+
                "<div class='gs-upload-ele-title-div'></div>"+
                "<div class='gs-upload-ele-menu'>"+
                "</div></div></div></div></div>"
            );
            //图片预览
            layer.photos({
                photos: '#uploader-list-othersPro',
                anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            //上传完毕
            arrOthersPro.push(res.data.src);
            $("#othersProImg").val(arrOthersPro);
        }
    });

    /**
     * 检索店名
     */
    var languageAjax = new $ax(Feng.ctxPath + "/btyXd/getDm");
    var languageResult = languageAjax.start();
    $.each(languageResult, function( index, val ) {
        $("#dm").append("<option value='"+val.dm+"'>"+val.dm+"</option>");
    } );
    form.render('select');
    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        //统计清洁卫生的分数
        var sum=0;
         var wwzt=$("input[name='wwzt']:checked").val();
         var qtdmzt=$("input[name='qtdmzt']:checked").val();
         var tszt=$("input[name='tszt']:checked").val();
         var dgzt=$("input[name='dgzt']:checked").val();
         var zswzt=$("input[name='zswzt']:checked").val();
         var btwpzt=$("input[name='btwpzt']:checked").val();
         var qtzt=$("input[name='qtzt']:checked").val();
         var zztzt=$("input[name='zztzt']:checked").val();
         var cjzt=$("input[name='cjzt']:checked").val();
         var xsjzt=$("input[name='xsjzt']:checked").val();

         var hctszt=$("input[name='hctszt']:checked").val();
         var hcqmzt=$("input[name='hcqmzt']:checked").val();
         var hcdmzt=$("input[name='hcdmzt']:checked").val();
         var hcsbzt=$("input[name='hcsbzt']:checked").val();
         var xwjzt=$("input[name='xwjzt']:checked").val();
         var klzt=$("input[name='klzt']:checked").val();
         var bxzt=$("input[name='bxzt']:checked").val();
         var djjzt=$("input[name='djjzt']:checked").val();
         var yyzzt=$("input[name='yyzzt']:checked").val();
         var xsdzt=$("input[name='xsdzt']:checked").val();

         if(wwzt=="是"){
             sum+=0.5;
         }
        if(qtdmzt=="是"){
            sum+=0.5;
        }
        if(tszt=="是"){
            sum+=0.5;
        }
        if(dgzt=="是"){
            sum+=0.5;
        }
        if(zswzt=="是"){
            sum+=0.5;
        }
        if(btwpzt=="是"){
            sum+=0.5;
        }if(qtzt=="是"){
            sum+=0.5;
        }if(zztzt=="是"){
            sum+=0.5;
        }if(cjzt=="是"){
            sum+=0.5;
        }if(xsjzt=="是"){
            sum+=0.5;
        }if(hctszt=="是"){
            sum+=0.5;
        }if(hcqmzt=="是"){
            sum+=0.5;
        }if(hcdmzt=="是"){
            sum+=0.5;
        }if(hcsbzt=="是"){
            sum+=0.5;
        }if(xwjzt=="是"){
            sum+=0.5;
        }if(klzt=="是"){
            sum+=0.5;
        }if(bxzt=="是"){
            sum+=0.5;
        }if(djjzt=="是"){
            sum+=0.5;
        }if(yyzzt=="是"){
            sum+=0.5;
        }if(xsdzt=="是"){
            sum+=0.5;
        }
        $("#qjwsdf").val(sum);
        //alert($("#qjwsdf").val());
        //alert("sumQjws"+sum);
        //统计仪容仪表得分
        var sumYryb=0;
        var ctybzt=$("input[name='ctybzt']:checked").val();
        var ctzjzt=$("input[name='ctzjzt']:checked").val();
        if(ctybzt=="是"){
            sumYryb+=1;
        }
        if(ctzjzt=="是"){
            sumYryb+=1;
        }
        $("#sumYryb").val(sumYryb);
        //alert("sumYryb"+sumYryb);
        //统计服务流程得分
        var sumFwlc=0;
        var fwkmzt=$("input[name='fwkmzt']:checked").val();
        var otherFwkmzt=$("input[name='otherFwkmzt']:checked").val();
        var othersFwkmzt=$("input[name='othersFwkmzt']:checked").val();
        var fwgczt=$("input[name='fwgczt']:checked").val();
        var otherFwgczt=$("input[name='otherFwgczt']:checked").val();
        var othersFwgczt=$("input[name='othersFwgczt']:checked").val();
        if(fwkmzt=="是"){
            sumFwlc+=2.5;
        }
        if(otherFwkmzt=="是"){
            sumFwlc+=2.5;
        }
        if(othersFwkmzt=="是"){
            sumFwlc+=2.5;
        }
        if(fwgczt=="是"){
            sumFwlc+=2.5;
        }
        if(otherFwgczt=="是"){
            sumFwlc+=2.5;
        }
        if(othersFwgczt=="是"){
            sumFwlc+=2.5;
        }
        $("#sumFwlc").val(sumFwlc);
        //alert("sumFwlc"+sumFwlc);
        //统计大众点评得分
        var sumDzdp=0;
        var dpzb=$("input[name='dpzb']:checked").val();
        var cpzb=$("input[name='cpzb']:checked").val();
        sumDzdp=parseInt(dpzb)+parseInt(cpzb);
        if(isNaN(sumDzdp)){
            sumDzdp=0;
        }
        $("#sumDzdp").val(sumDzdp);
       // alert(sumDzdp);
        var sumCppz=0;

        //统计产品品质得分
        var sfbz=$("input[name='sfbz']:checked").val();
        var sfbzOne=$("input[name='sfbzOne']:checked").val();
        var sfbzTwo=$("input[name='sfbzTwo']:checked").val();
        var sfbzThree=$("input[name='sfbzThree']:checked").val();
        var sfbzFour=$("input[name='sfbzFour']:checked").val();
        var sfbzfive=$("input[name='sfbzfive']:checked").val();
        var sczt=$("input[name='sczt']:checked").val();
        var scztOne=$("input[name='scztOne']:checked").val();
        var scztTwo=$("input[name='scztTwo']:checked").val();
        var scztThree=$("input[name='scztThree']:checked").val();
        var scztFour=$("input[name='scztFour']:checked").val();
        var scztFive=$("input[name='scztFive']:checked").val();
        var cpzt=$("input[name='cpzt']:checked").val();
        var cpztOne=$("input[name='cpztOne']:checked").val();
        var cpztTwo=$("input[name='cpztTwo']:checked").val();
        var cpztThree=$("input[name='cpztThree']:checked").val();
        var cpztFour=$("input[name='cpztFour']:checked").val();
        var cpztFive=$("input[name='cpztFive']:checked").val();

        if(sfbz=="是"){
            sumCppz+=25/18;
        }
        if(sfbzOne=="是"){
            sumCppz+=25/18;
        }
        if(sfbzTwo=="是"){
            sumCppz+=25/18;
        }
        if(sfbzThree=="是"){
            sumCppz+=25/18;
        }
        if(sfbzFour=="是"){
            sumCppz+=25/18;
        }
        if(sfbzfive=="是"){
            sumCppz+=25/18;
        }
        if(sczt=="是"){
            sumCppz+=25/18;
        }
        if(scztOne=="是"){
            sumCppz+=25/18;
        }
        if(scztTwo=="是"){
            sumCppz+=25/18;
        }
        if(scztThree=="是"){
            sumCppz+=25/18;
        }
        if(scztFour=="是"){
            sumCppz+=25/18;
        }
        if(scztFive=="是"){
            sumCppz+=25/18;
        }
        if(cpzt=="是"){
            sumCppz+=25/18;
        }
        if(cpztOne=="是"){
            sumCppz+=25/18;
        }
        if(cpztTwo=="是"){
            sumCppz+=25/18;
        }
        if(cpztThree=="是"){
            sumCppz+=25/18;
        }
        if(cpztFour=="是"){
            sumCppz+=25/18;
        }
        if(cpztFive=="是"){
            sumCppz+=25/18;
        }
        //检查过程中发现食品安全问题,产品品质得分为0
        var spaqzt=$("input[name='spaqzt']:checked").val();
        if(spaqzt=="是"){
            sumCppz=0;
        }
        sumCppz=Math.round(sumCppz);
        $("#sumCppz").val(sumCppz);
        //alert("sumCppz"+sumCppz);

        //统计效期得分
        var sumYxq=0;
        var kfhwlx=$("#kfhwlx").val();
        var tbwllx=$("#tbwllx").val();
        sumYxq=parseInt(kfhwlx)+parseInt(tbwllx);
        sumYxq=8-sumYxq;
        //效期检查过程中发现有过期货物,有效期得分为0
        var gqhwlx=$("input[name='gqhwlx']:checked").val();
        if(gqhwlx=="是"){
            sumYxq=0;
        }
        if(isNaN(sumYxq)){
            sumYxq=0;
        }
        $("#sumXq").val(sumYxq);
         var zf=sum+sumYryb+sumFwlc+sumDzdp+sumYxq+sumCppz;
         if(isNaN(zf)){
             zf=0;
         }
        $("#zf").val(zf);
        var ajax = new $ax(Feng.ctxPath + '/btyXd/add',function (data) {
            Feng.success("添加成功！");
            localStorage.clear();
            //传给上个页面，刷新table用
            admin.putTempData('formOk', true);
            //关掉对话框
            admin.closeThisDialog();

        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.set("qjwsdf",sum);
        ajax.set("yrybdf",sumYryb);
        ajax.set("fwlcdf",sumFwlc);
        ajax.set("dzdpdf",sumDzdp);
        ajax.set("xqdf",sumYxq);
        ajax.set("cppzdf",sumCppz);
        ajax.set("zf",zf);
        ajax.start();
        //添加 return false 可成功跳转页面
        return false;
    });


});